<?php 
include_once('includes.php'); 	
?>
<?php include_once('includes/header.php'); 	 ?>
<span class="title">Competition</span>

<a href="create-competition" title="Create new competition">Create new competition</a>
<table> 
	<thead>
		<tr>
			<th> Name </th>
			<th> Description</th>
			<th> </th>
		</tr>
	</thead>
	
<?php 
$sql = "select * from competition order by name desc ";
$competitions=db_fetch_all($sql);
foreach($competitions as $competition)
{
?>
	<tr>
		<td style="width:150px"><?php echo $competition->name;?></td>
		<td style="text-align:left"><?php echo $competition->description;?></td>
		<td  style="width:100px"><a href="create-competition?id=<?php echo $competition->id; ?>">Edit</a> | <a onclick="if(!confirm('Do you want to delete this competition?')) return false;" href="create-competition?task=delete&id=<?php echo $competition->id; ?>">Delete</a></td>
	</tr>
<?php
}
?>
</table>

<?php include_once('includes/footer.php'); 	 ?>